var e = require;
var t = module;
var o = exports;
Object.defineProperty(o, "__esModule", {value: !0});
var n = e("LoadRes"),
    a = e("AD"),
    i = cc._decorator,
    r = i.ccclass,
    s = i.property,
    l = (function (e) {
        function t() {
            var t = (null !== e && e.apply(this, arguments)) || this;
            return (t.icon = null), (t.close_btn = null), (t.nativeInfo = null), t;
        }
        return (
            __extends(t, e),
            (t.prototype.onEnable = function () {
                this.initView(), this.addEvent();
            }),
            (t.prototype.initView = function () {
                var e = this;
                if (
                    (console.log("=====", this.nativeInfo),
                    (this.nativeInfo = a.default.getInstance().getIconNativeInfo()),
                    this.nativeInfo &&
                        this.nativeInfo.adId &&
                        (this.nativeInfo.Native_icon || this.nativeInfo.Native_BigImage))
                ) {
                    a.default.getInstance().reportNative(this.nativeInfo.adId);
                    var t = this.nativeInfo.Native_icon;
                    t || (t = this.nativeInfo.Native_BigImage),
                        n.default.loadResCustom(
                            t + "?.png",
                            function (t) {
                                e.icon.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(t);
                            },
                            function () {
                                e.node.active = !1;
                            }
                        );
                } else this.node.active = !1;
                setTimeout(function () {
                    e.node && e.node.active && e.initView();
                }, 3e4);
            }),
            (t.prototype.addEvent = function () {
                this.node.on("click", this.nativeClick, this), this.close_btn.on("click", this.closeThisNode, this);
            }),
            (t.prototype.nativeClick = function () {
                a.default.getInstance().nativeClick(this.nativeInfo.adId);
            }),
            (t.prototype.closeThisNode = function () {
                this.node.active = !1;
            }),
            __decorate([s(cc.Node)], t.prototype, "icon", void 0),
            __decorate([s(cc.Node)], t.prototype, "close_btn", void 0),
            __decorate([r], t)
        );
    })(cc.Component);
o.default = l;
